﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using IQKS.AWP.BusinessObject;

namespace IQKS.AWP.DataAccessLayer
{
    public class ActivityMasterDAL
    {
        public DataSet GetActivityMaster(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("Usp_GetActivityMaster", param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }


        public object SetActivityMaster(ActivityMasterBO param)
        {
            try
            {

                SqlParameter[] parameters = new SqlParameter[]
			{
                new SqlParameter("@SetMethod",param.SetMethod),
				new SqlParameter("@ActivityID", param.ActivityID),
                new SqlParameter("@ActivityTypeID", param.ActivityTypeID),
				new SqlParameter("@ActivityName", param.ActivityName),
                new SqlParameter("@ActivityCode",param.ActivityCode),
                new SqlParameter("@CreatedBy",param.CreatedBy),
                new SqlParameter("@ModifyBy",param.ModifyBy),
                new SqlParameter("@ModifyDate",param.ModifyDate),
                new SqlParameter("@IsActive",param.IsActive),
              
			};
                return DataUtils.ExecuteScalar("Usp_SetActivityMaster", parameters);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }


        public DataSet GetActivityByActivityType(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("Usp_GetActivityByActivityType", param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }

        //TODO SAVE IN Country Master DAL
        public DataSet GetCountryMasterActive(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("Usp_GetCountryMasterActive", param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }


        public DataSet GetRegionMasterActive(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("Usp_GetRegionMasterActive", param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }
    }
}
